package com.xqboss.apps.mapper.user;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.xqboss.apps.domain.user.SysUserWalletRecord;
import com.xqboss.apps.domain.user.SysUserWalletWithdraw;
import com.xqboss.apps.dto.user.GetWithdrawListDto;
import com.xqboss.apps.dto.user.WithdrawRecordListDto;
import com.xqboss.apps.enums.user.WithdrawStatusEnum;
import com.xqboss.apps.vo.user.CheckUserWalletVo;
import com.xqboss.apps.vo.user.SysUserWalletRecordVo;
import com.xqboss.apps.vo.user.WithdrawListVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;

/**
 * @author Trent
 * @date 2023/8/15
 * 用户钱包提现
 */
@Repository
public interface SysUserWalletWithdrawMapper extends BaseMapper<SysUserWalletWithdraw> {

    /**
     * 搜索提现列表
     * @param params
     * @return
     */
    List<WithdrawListVo> selectVoList(GetWithdrawListDto params);

    /**
     * 获取提现详情
     * @param id
     * @return
     */
    WithdrawListVo getVoById(Long id);

    /**
     * 获取用户提现金额统计
     * @param userId
     * @param statusList
     * @param date
     * @return
     */
    BigDecimal getUserWithdrawAmount(@Param("userId") Long userId,
                                     @Param("status") List<WithdrawStatusEnum> statusList,
                                     @Param("date") LocalDate date);

    BigDecimal selectVoListTotal(GetWithdrawListDto params);

    BigDecimal getUserTotalAmount();

    /**
     * 获取钱包变动记录
     * @param queryWrapper
     * @return
     */
    List<SysUserWalletRecordVo> getRecordList(@Param(Constants.WRAPPER) QueryWrapper<SysUserWalletRecord> queryWrapper);

    List<SysUserWalletRecordVo> getwrenchRecordList(WithdrawRecordListDto params);

    CheckUserWalletVo checkWalletAmount(@Param("userId") Long userId, @Param("type") Integer type);
}
